package com.yonyou.pmclouds.basecom.conf;

import com.yonyou.pmclouds.basecom.condition.PublicDeployCondition;
import com.yonyou.pmclouds.basecom.util.HttpTookit;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PmCloudConfiguration {

    @Configuration
    @EnableConfigurationProperties(ProductActiveProperties.class)
    @Conditional(PublicDeployCondition.class)
    protected static class ProductActiveConfiguration {

        private final ProductActiveProperties properties;

        public ProductActiveConfiguration(ProductActiveProperties properties) {
            this.properties = properties;
        }

    }

    @Configuration
    @EnableConfigurationProperties(HttpClientProperties.class)
    public class HttpClientConfiguration {

        private final HttpClientProperties properties;

        public HttpClientConfiguration(HttpClientProperties properties) {
            this.properties = properties;
        }

        public void setProperties() {
            HttpTookit.setProperties(properties);
        }
    }

    @Configuration
    @EnableConfigurationProperties(PMCloudServerProperties.class)
    public class PMCloudServerConfiguration {

        private final PMCloudServerProperties properties;

        public PMCloudServerConfiguration(PMCloudServerProperties properties) {
            this.properties = properties;
        }
    }
}
